package user

import (
	"github.com/bgmp/config"
	"github.com/bgmp/middleware"
	"github.com/bgmp/model"
	"github.com/gin-gonic/gin"
)

func (b Base) ListBgs(c *gin.Context, req *ListBgsRequest) *ListBgsResponse {

	bgs := model.ListBgViews(config.DB,
		map[string]any{model.Bg_UserId: middleware.GetUserId(c)},
		&req.BgSelectConditions,
	)
	return &ListBgsResponse{
		Bgs: bgs,
	}
}

type ListBgsRequest struct {
	model.BgSelectConditions
}

type ListBgsResponse struct {
	Bgs []model.BgView `json:"bgs"`
}
